<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'jjsg.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css"
	href="<%=basePath %>resources/style/ext-theme-gray-all.css" />
<script type="text/javascript" src="<%=basePath %>resources/script/ext-all.js"></script>

<script type="text/javascript">
	
Ext.onReady(function () {
    new Ext.Button({
        renderTo: "div1",
        text: "后台Ajax提交json",
        handler: function () {
            Ext.Ajax.request({
                url: 'games/jsonTest',
                headers: {
                    'userHeader': 'userMsg'
                },
                params: { a: 10, b: 20 },
                method: 'GET',
                success: function (response, options) {
                    Ext.MessageBox.alert('成功', '从服务端获取结果: ' + response.responseText);
                },
                failure: function (response, options) {
                    Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号：' + response.status);
                }
            });
        },
        id: "bt1"
	    });
	    
	new Ext.Button({
        renderTo: "div1",
        text: "后台Ajax提交string",
        handler: function () {
            Ext.Ajax.request({
                url: 'games/stringTest',
                headers: {
                    'userHeader': 'userMsg'
                },
                params: { a: 10, b: 20 },
                method: 'GET',
                success: function (response, options) {
                    Ext.MessageBox.alert('成功', '从服务端获取结果: ' + response.responseText);
                },
                failure: function (response, options) {
                    Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号：' + response.status);
                }
            });
        },
        id: "bt1"
	    });
});
</script>
</head>

<body>
	街机三国
	<a href="games/jsonTest">sssss</a>
	
<h1>Ajax服务端请求</h1>
<div class="content" id="div1">
<div>一共发起了<span id="span1" style="color:Red">0</span>次请求。</div>
</div>
</body>
</html>
